package com.tqjc.work;

import com.tqjc.consts.WorkConst;
import com.tqjc.entity.WorkStatus;
import org.springframework.stereotype.Component;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;


@Component
public class TaskStatus {
    Map<String, WorkStatus> workStatusMap = new ConcurrentHashMap<>();


    public TaskStatus() {

        workStatusMap.put(WorkConst.CRANETYPE, new WorkStatus());
    }


    public WorkStatus getWorkStatus4Crane() {
        return workStatusMap.get(WorkConst.CRANETYPE);

    }

    public void setWorkStatus4Crane(WorkStatus workStatus) {
        workStatusMap.put(WorkConst.CRANETYPE, workStatus);
    }


    public void setTaskStatus4Crane(String nowStatus) {
        if (workStatusMap.containsKey(WorkConst.CRANETYPE)) {
            workStatusMap.get(WorkConst.CRANETYPE).setNowTask(nowStatus);
        }

    }



    public void setStepStatus4Crane(String nowStep) {
        if (workStatusMap.containsKey(WorkConst.CRANETYPE)) {
            workStatusMap.get(WorkConst.CRANETYPE).setNowStep(nowStep);
        }
    }


}
